package com.eling.elcms.travel.webapp.controller;

import com.eling.elcms.core.dao.hibernate.search.SearchCondition;
import com.eling.elcms.core.webapp.controller.BaseFormController;
import com.eling.elcms.core.webapp.controller.Msg;
import com.eling.elcms.core.webapp.spring.ModelFilling;
import com.eling.elcms.travel.model.AllianceConfirm;
import com.eling.elcms.travel.model.view.AllianceConfirmView;
import com.eling.elcms.travel.service.IAllianceConfirmManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class AllianceConfirmController extends BaseFormController{

	@Autowired
	private IAllianceConfirmManager allConfManager;
	
	@RequestMapping("/api/allianceconfirm/save")
    @ResponseBody
	public AllianceConfirm save(@ModelAttribute@ModelFilling AllianceConfirm cond){
		return allConfManager.save(cond);
	}
	
	@RequestMapping("/api/allianceconfirm/{pkAllianceConfirm}/delete")
	@ResponseBody
	public Msg delete(@PathVariable Long pkAllianceConfirm){
		allConfManager.remove(pkAllianceConfirm);
		return new Msg("删除成功");
	}
	
	@RequestMapping("/api/allianceconfirm/query")
    @ResponseBody
	public List<AllianceConfirm> query(@ModelAttribute AllianceConfirm cond){
		return allConfManager.query(cond);
	}
	
	@RequestMapping("/api/allianceconfirm/search*")
	@ResponseBody
	public List<AllianceConfirm> search(@ModelAttribute SearchCondition sc,@ModelAttribute AllianceConfirm cond){
		sc.setQueryCondition(cond);
		return allConfManager.search(sc);
	}
	
	@RequestMapping("/api/allianceconfirm/saveall")
    @ResponseBody
	public AllianceConfirmView saveAll(@ModelAttribute AllianceConfirmView cond){
		return allConfManager.saveAll(cond);
	}
	
}
